package com.ledong.se.string;

import java.util.Calendar;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;

public class TestEntity {
    public static void main(String[] args) {
        B b = new B();
        
        for (int j = 0; j < 10; j++) {
            long hashtable_start_time = Calendar.getInstance()
                    .getTimeInMillis();
            for (int i = 0; i < 100000; i++) {
                b.hashtable.put(String.valueOf(i), String.valueOf(i));
            }
            long hashtable_end_time = Calendar.getInstance().getTimeInMillis();
            long hashmap_start_time = Calendar.getInstance().getTimeInMillis();
            for (int i = 0; i < 100000; i++) {
                b.hashMap.put(String.valueOf(i), String.valueOf(i));
            }
            long hashmap_end_time = Calendar.getInstance().getTimeInMillis();
//            System.out.println("hashtable 开始时间:" + hashtable_start_time);
//            System.out.println("hashtable 结束时间:" + hashtable_end_time);
            System.out.println("hashtable所用时间：" + (hashtable_end_time - hashtable_start_time));
//            System.out.println("=========================================");
//            System.out.println("hashmap 开始时间:" + hashmap_start_time);
//            System.out.println("hashmap 结束时间:" + hashmap_end_time);
            System.out.println("hashmap：" + (hashmap_end_time - hashmap_start_time));
            System.err.println("#########################################");
            System.out.println("");
            System.out.println("");
            System.out.println("");
        }

    }
}

class B {
    public Map<String, String> hashtable = new Hashtable<String, String>();
    public Map<String, String> hashMap = new HashMap<String, String>();
}
